home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3x / crypt.z / crypt
Encoding:
Text File  |  1998-10-20  |  7.4 KB  |  133 lines

  1.  
  2.  
  3.  
  4. CCCCRRRRYYYYPPPPTTTT((((3333XXXX))))                                                            CCCCRRRRYYYYPPPPTTTT((((3333XXXX))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      crypt - password and file encryption functions
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      cccccccc [[[[ffffllllaaaagggg ............]]]] ffffiiiilllleeee ............ ----llllccccrrrryyyypppptttt
  13.  
  14.      cccchhhhaaaarrrr ****ccccrrrryyyypppptttt((((cccchhhhaaaarrrr ****kkkkeeeeyyyy,,,, cccchhhhaaaarrrr ****ssssaaaalllltttt))));;;;
  15.  
  16.      vvvvooooiiiidddd sssseeeettttkkkkeeeeyyyy((((cccchhhhaaaarrrr ****kkkkeeeeyyyy))));;;;
  17.  
  18.      vvvvooooiiiidddd eeeennnnccccrrrryyyypppptttt((((cccchhhhaaaarrrr ****bbbblllloooocccckkkk,,,, iiiinnnntttt ffffllllaaaagggg))));;;;
  19.  
  20.      cccchhhhaaaarrrr ****ddddeeeessss____ccccrrrryyyypppptttt((((cccchhhhaaaarrrr ****kkkkeeeeyyyy,,,, cccchhhhaaaarrrr ****ssssaaaalllltttt))));;;;
  21.  
  22.      vvvvooooiiiidddd ddddeeeessss____sssseeeettttkkkkeeeeyyyy((((cccchhhhaaaarrrr ****kkkkeeeeyyyy))));;;;
  23.  
  24.      vvvvooooiiiidddd ddddeeeessss____eeeennnnccccrrrryyyypppptttt((((cccchhhhaaaarrrr ****bbbblllloooocccckkkk,,,, iiiinnnntttt ffffllllaaaagggg))));;;;
  25.  
  26.      iiiinnnntttt rrrruuuunnnn____sssseeeettttkkkkeeeeyyyy((((iiiinnnntttt pppp[[[[2222]]]],,,, cccchhhhaaaarrrr ****kkkkeeeeyyyy))));;;;
  27.  
  28.      iiiinnnntttt rrrruuuunnnn____ccccrrrryyyypppptttt((((lllloooonnnngggg ooooffffffffsssseeeetttt,,,, cccchhhhaaaarrrr ****bbbbuuuuffffffffeeeerrrr,,,, uuuunnnnssssiiiiggggnnnneeeedddd iiiinnnntttt ccccoooouuuunnnntttt,,,, iiiinnnntttt pppp[[[[2222]]]]))));;;;
  29.  
  30.      iiiinnnntttt ccccrrrryyyypppptttt____cccclllloooosssseeee((((iiiinnnntttt pppp[[[[2222]]]]))));;;;
  31.  
  32. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  33.      _d_e_s__c_r_y_p_t is the password encryption function.  It is based on a one way
  34.      hashing encryption algorithm with variations intended (among other
  35.      things) to frustrate use of hardware implementations of a key search.
  36.  
  37.      _K_e_y is a user's typed password.  _S_a_l_t is a two-character string chosen
  38.      from the set [aaaa----zzzzAAAA----ZZZZ0000----9999....////]; this string is used to perturb the hashing
  39.      algorithm in one of 4096 different ways, after which the password is used
  40.      as the key to encrypt repeatedly a constant string.  The returned value
  41.      points to the encrypted password.  The first two characters are the salt
  42.      itself.
  43.  
  44.      The _d_e_s__s_e_t_k_e_y and _d_e_s__e_n_c_r_y_p_t entries provide (rather primitive) access
  45.      to the actual hashing algorithm.  The argument of _d_e_s__s_e_t_k_e_y is a
  46.      character array of length 64 containing only the characters with
  47.      numerical value 0 and 1.  If this string is divided into groups of 8, the
  48.      low-order bit in each group is ignored; this gives a 56-bit key which is
  49.      set into the machine.  This is the key that will be used with the hashing
  50.      algorithm to encrypt the string _b_l_o_c_k with the function _d_e_s__e_n_c_r_y_p_t.
  51.  
  52.      The argument to the _d_e_s__e_n_c_r_y_p_t entry is a character array of length 64
  53.      containing only the characters with numerical value 0 and 1.  The
  54.      argument array is modified in place to a similar array representing the
  55.      bits of the argument after having been subjected to the hashing algorithm
  56.      using the key set by _d_e_s__s_e_t_k_e_y.  If _e_d_f_l_a_g is zero, the argument is
  57.      encrypted; if non-zero, it is decrypted.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. CCCCRRRRYYYYPPPPTTTT((((3333XXXX))))                                                            CCCCRRRRYYYYPPPPTTTT((((3333XXXX))))
  71.  
  72.  
  73.  
  74.      Note that decryption is not provided in the international version of
  75.      _c_r_y_p_t.  The international version is part of the C Development Set, and
  76.      the domestic version is part of the Encryption Utilities.  If decryption
  77.      is attempted with the international version of _d_e_s__e_n_c_r_y_p_t, an error
  78.      message is printed.
  79.  
  80.      _C_r_y_p_t, _s_e_t_k_e_y, and _e_n_c_r_y_p_t are front-end routines that invoke _d_e_s__c_r_y_p_t,
  81.      _d_e_s__s_e_t_k_e_y, and _d_e_s__e_n_c_r_y_p_t respectively.
  82.  
  83.      The routines _r_u_n__s_e_t_k_e_y and _r_u_n__c_r_y_p_t are designed for use by
  84.      applications that need cryptographic capabilities [such as _e_d(1) and
  85.      _v_i(1)] that must be compatible with the _c_r_y_p_t(1) user-level utility.
  86.      _R_u_n__s_e_t_k_e_y establishes a two-way pipe connection with _c_r_y_p_t(1), using _k_e_y
  87.      as the password argument.  _R_u_n__c_r_y_p_t takes a block of characters and
  88.      transforms the cleartext or ciphertext into their ciphertext or cleartext
  89.      using _c_r_y_p_t(1). _O_f_f_s_e_t is the relative byte position from the beginning
  90.      of the file that the block of text provided in _b_l_o_c_k is coming from.
  91.      _C_o_u_n_t is the number of characters in _b_l_o_c_k, and _c_o_n_n_e_c_t_i_o_n is an array
  92.      containing indices to a table of input and output file streams. When
  93.      encryption is finished, _c_r_y_p_t__c_l_o_s_e is used to terminate the connection
  94.      with _c_r_y_p_t(1).
  95.  
  96.      If a null key is passed to _r_u_n__s_e_t_k_e_y, 0 is returned.  Otherwise, 1 is
  97.      returned.  _R_u_n__c_r_y_p_t returns -1 if it cannot write output or read input
  98.      from the pipe attached to _c_r_y_p_t. Otherwise it returns 0.
  99.  
  100.      The routines above are  found in the library ``libcrypt.a'', and are
  101.      loaded if the option ``-lcrypt'' is used with _c_c(1) or _l_d(1).
  102.  
  103. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  104.      crypt(1), login(1), passwd(1), getpass(3C), passwd(4).
  105.  
  106. NNNNOOOOTTTTEEEESSSS
  107.      In the international version of _c_r_y_p_t(3X), a flag argument of 1 to
  108.      _e_n_c_r_y_p_t or _d_e_s__e_n_c_r_y_p_t is not accepted, and _e_r_r_n_o is set to _E_N_O_S_Y_S to
  109.      indicate that the functionality is not available.
  110.  
  111.      The return value in _c_r_y_p_t points to static data that are overwritten by
  112.      each call.
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.